package com.ma.pojo;

public class queueFromStack {
    public stack<Integer> stackPush;
    public stack<Integer> stackPop;

    public queueFromStack(){
        stackPush=new stack<>();
        stackPop=new stack<>();

    }


    //将push导入pop
    private void pushToPop(){
        if(stackPop==null){
            while (stackPush!=null){
                stackPop.push((stackPush.remove()));
            }
        }
    }

    public void add(int pushInt){
        stackPush.push(pushInt);
        pushToPop();

    }

}
